<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>测试页面</title>
</head>

<body>
    <script>
        class Store {
            constructor(options) {
                this.name = options.name
            }

            commit = (type) => { 
                
            }
        }

        function creatStore(options) {
            return new Store(options)
        }

        const store = creatStore({
            name: 'xiaomi',

            mutations: { 
                add () { 
                    console.log('add')
                },

                reduce () { 
                    console.log('reduce')
                }
            }
        })

        console.log(store.name)

        store.commit()

    </script>
</body>

</html>